# coding:utf-8

from wtforms import StringField
from wtforms_components import IntegerField, SelectField
from wtforms.validators import Optional

from ..forms import WphForm, NonValidatingSelectField, NotChoices
from .constant import BillType, BillSubType, BillStatus


class SearchBillForm(WphForm):
    """
    created by chenhj at 2017/8/7

    """
    id = IntegerField('交易ID', validators=[Optional()])
    uid = IntegerField('用户ID', validators=[Optional()])
    user_mobile = StringField('手机号', validators=[Optional()])
    type = NonValidatingSelectField(
        '类型', validators=[Optional()],
        choices=NotChoices + BillType.to_options(), coerce=int
    )
    sub_type = NonValidatingSelectField(
        '子类型', validators=[Optional()],
        choices=NotChoices + BillSubType.to_options(), coerce=int
    )
    status = SelectField(
        '状态', validators=[Optional()],
        choices=[(-1, '所有')] + BillStatus.to_options(), coerce=int
    )
    # item = StringField('具体项', validators=[Optional()])
